Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(crosschain): move ballot voting logic into observer #1511

Merged
merged 32 commits into from
Feb 29, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Jan 2, 2024

Description

Move the voting logic for inbound and outbound to the observer module and add unit tests to the voting functions.

Closes: #1451

Copy link

github-actions bot commented Jan 2, 2024

!!!WARNING!!!
nosec detected in the following files: x/observer/keeper/msg_server_update_observer_test.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Jan 2, 2024
@lumtis lumtis changed the title Refactor/outbound inbound validation refactor(crosschain): move ballot voting logic into observer Jan 2, 2024
@brewmaster012
Copy link
Collaborator

similar issue:
#1515

@lumtis lumtis marked this pull request as ready for review February 20, 2024 20:35
@lumtis lumtis requested a review from kingpinXD February 26, 2024 09:25
Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 56.55172% with 63 lines in your changes are missing coverage. Please review.

Project coverage is 38.41%. Comparing base (cfd27a7) to head (580e897).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1511      +/-   ##
===========================================
+ Coverage    38.03%   38.41%   +0.37%     
===========================================
  Files          205      206       +1     
  Lines        12524    12584      +60     
===========================================
+ Hits          4764     4834      +70     
+ Misses        7372     7362      -10     
  Partials       388      388              
Files Coverage Δ
x/crosschain/keeper/cctx.go 90.10% <100.00%> (ø)
x/crosschain/keeper/evm_deposit.go 55.93% <100.00%> (ø)
x/fungible/keeper/deposits.go 86.84% <100.00%> (ø)
x/observer/types/ballot.go 95.08% <ø> (ø)
x/observer/keeper/vote_outbound.go 77.77% <77.77%> (ø)
common/chain.go 31.45% <0.00%> (-0.52%) ⬇️
x/crosschain/keeper/msg_server_vote_inbound_tx.go 41.28% <82.85%> (+14.01%) ⬆️
x/observer/keeper/vote_inbound.go 82.85% <82.85%> (ø)
x/crosschain/keeper/msg_server_vote_outbound_tx.go 16.12% <0.00%> (+1.20%) ⬆️
x/observer/types/observer_set.go 11.11% <14.28%> (+11.11%) ⬆️
... and 1 more

... and 3 files with indirect coverage changes

Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Copy link
Collaborator

@brewmaster012 brewmaster012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lumtis lumtis requested a review from kingpinXD February 28, 2024 08:47
@lumtis lumtis merged commit 85eda62 into develop Feb 29, 2024
20 checks passed
@lumtis lumtis deleted the refactor/outbound-inbound-validation branch February 29, 2024 06:53
lumtis added a commit that referenced this pull request Mar 5, 2024
* move logic for ballot voting for inbound

* fix mocks

* goimports

* changelog

* fix unit tests

* fix CI =

* x/observer/keeper/vote_outbound.go x/crosschain/types/expected_keepers.go x/crosschain/keeper/msg_server_vote_outbound_tx.go

* update mocks

* refactor finalized check

* make generate

* initialize vote inbound tests

* add sdk keepers in observer testutil

* implement mock option for observer

* inbound vote test

* initialize outbound tests

* goimports

* vote outbound tests

* update changelog

* test with integration tests

* add isNew in vote_inbound

* add tests back

* use tmp context for ballot logic

* add new test for finalized ballot

* add not finzalized test
lumtis added a commit that referenced this pull request Mar 12, 2024
* simplify docker compose

* fix makefi;e

* add new version

* type

* fix restart client

* some fixes

* add light upgrade test

* fix gov sending

* add admin function test command

* performance test

* fix lint

* add pprof port

* some fixes in tests

* test: emissions unit test (#1767)

* ci: run build workflow on develop push for code coverage generation (#1793)

* refactor: zetaclient metrics (#1783)

* Refactor zetaclient metrics

* Fix blame counter init

* Add changelog entry

* Add unreleased to changelog

* Remove blank line

* feat: initiated feature of zetaclient-restricted-address (#1790)

* initiated feature of zetaclient-banned-address

* fix some issues in e2e tests

* fix gosec issues

* some unit tests, comments and refactor

* unified log prints for restricted address detection

* move restricted address to Unreleased section

* improved compliance log prints

* update compliance log print according to CharlieMc

* chore(codecov.yml): fix ignore extension (#1814)

* chore(codecov.yml): fix ignore extension

* changelog

* refactor: remove params from config and introduce app context (#1774)

* refactor(`crosschain`): move ballot voting logic into `observer` (#1511)

* move logic for ballot voting for inbound

* fix mocks

* goimports

* changelog

* fix unit tests

* fix CI =

* x/observer/keeper/vote_outbound.go x/crosschain/types/expected_keepers.go x/crosschain/keeper/msg_server_vote_outbound_tx.go

* update mocks

* refactor finalized check

* make generate

* initialize vote inbound tests

* add sdk keepers in observer testutil

* implement mock option for observer

* inbound vote test

* initialize outbound tests

* goimports

* vote outbound tests

* update changelog

* test with integration tests

* add isNew in vote_inbound

* add tests back

* use tmp context for ballot logic

* add new test for finalized ballot

* add not finzalized test

* remove unused comment

* fix bitcoin credentials

* change upgrade version

* fix performance tests

* handler

* fix setup handler

* add light flag and use it for upgrade tests

* fix username

* add performance test back

* Update cmd/zetae2e/local/ethereum.go

* stefan comments

* changelog

* fix

---------

Co-authored-by: Tanmay <[email protected]>
Co-authored-by: skosito <[email protected]>
Co-authored-by: Charlie Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move inbound/outbound validation logic from crosschain to observer
4 participants